// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const publicapi = {
  /**
      * 获取字典数据
      */
  getDictData(params) {
    return Service.get(
      `/${ServiceName}/api/external/public/listdict?dicttype=${params}`
    )
  },
  /**
     * 获取省份
     */
  reqGetProvinceData() {
    return Service.get(
      `/${ServiceName}/api/external/public/getprovince`
    )
  },
  /**
     * 获取城市
     * @param {*} params 根据省份
     */
  reqGetCityData(params) {
    return Service.get(
      `/${ServiceName}/api/external/public/getcitybyprovince?dm=${params}`
    )
  },
  /**
   * 审核
   */
  auditdata (params) {
    return Service.put(
      `/${ServiceName}/api/external/mtc_company/updatestatus?id=${params}`
    )
  },
  /**
   * 新增客户信息
   */
  addcus (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/mtc_company/add`,params
    )
  },
  /**
   * 修改客户信息
   */
  updatecus (params) {
    return Service.put(
      `/${ServiceName}/api/external/mtc_company_recieptadd/updatebyid`
    )
  },
  /**
   * 获取客户信息
   */
  queryById (params) {
    return Service.get(
      `/${ServiceName}/api/external/mtc_company/queryById?id=${params}`
    )
  },
  /**
   * 新增修改信用额度信息
   */
   updateCreditLimit (params) {
    return Service.post(
      `/${ServiceName}/api/external/mtc_company/updateCreditLimit`, params
    )
  },
}

export default publicapi
